<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>04.ES6里面的结构赋值</title>
</head>

<body>
  <script>
    /* 
ES6里面允许按照一定的模式从数组和对象中提取值，对变量进行赋值，这被称为结构赋值
*/
    //1.数组的解构
    let F4 = ["小沈阳", "刘能", "赵四", "宋小宝"];
    let [xiao, liu, zhao, song] = F4;
    console.log(xiao);
    console.log(liu);
    console.log(zhao);
    console.log(song);

    //2.对象的解构
    let obj = {
      name: "赵本山",
      age: 70,
      xiaopin: function () {
        console.log("昨天，今天，明天");
      }
    }
    let {
      name,
      age,
      xiaopin
    } = obj;
    console.log(name);
    console.log(age);
    console.log(xiaopin);
    //调用
    xiaopin();
  </script>
</body>

</html>